﻿namespace LevelEditors
{
    using System;
    using System.Collections.Generic;
    using System.Runtime.CompilerServices;
    using UnityEngine;
    using UnityEngine.UI;

    public class UIContentGroup : MonoBehaviour
    {
        private List<UIElement> contents = new List<UIElement>();
        [SerializeField]
        private UIElement m_contentPrefab;
        [SerializeField]
        private InputField m_filterInputField;
        [SerializeField]
        private ScrollRect m_scrollRect;

        protected virtual void Awake()
        {
            this.tsm = base.GetComponent<RectTransform>();
            this.toggleGroup = base.GetComponent<ToggleGroup>();
        }

        public UIElement GetContent(string guid)
        {
            <GetContent>c__AnonStorey34 storey = new <GetContent>c__AnonStorey34 {
                guid = guid
            };
            return this.contents.Find(new Predicate<UIElement>(storey.<>m__C));
        }

        public void Ping(string label)
        {
            <Ping>c__AnonStorey35 storey = new <Ping>c__AnonStorey35 {
                label = label
            };
            UIElement element = this.contents.Find(new Predicate<UIElement>(storey.<>m__D));
            if (element != null)
            {
                this.m_scrollRect.verticalNormalizedPosition = 1f - (-element.tsm.localPosition.y / this.tsm.sizeDelta.y);
            }
        }

        private string filter
        {
            get
            {
                return this.m_filterInputField.text;
            }
            set
            {
                this.m_filterInputField.text = value;
            }
        }

        protected ToggleGroup toggleGroup { get; private set; }

        protected RectTransform tsm { get; private set; }

        [CompilerGenerated]
        private sealed class <GetContent>c__AnonStorey34
        {
            internal string guid;

            internal bool <>m__C(UIElement x)
            {
                return (x.guid == this.guid);
            }
        }

        [CompilerGenerated]
        private sealed class <Ping>c__AnonStorey35
        {
            internal string label;

            internal bool <>m__D(UIElement x)
            {
                return (x.label == this.label);
            }
        }
    }
}

